<!--
 * @Author: shy_didi
 * @Date: 2020-06-08 10:18:21
 * @LastEditTime: 2020-06-09 10:22:55
 * @LastEditors: Please set LastEditors
 * @Description: 首页轮播
 * @FilePath: \发明人\fmr\src\pages\home\components\swiper.vue
--> 
<template>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="item of slides" :key="item.id">
      <router-link to="path:'/home'">
        <van-image :src="item.img_path" lazy-load>
          <template v-slot:loading>
            <van-loading type="spinner" size="20" />
          </template>
        </van-image>
      </router-link>
    </van-swipe-item>
  </van-swipe>
</template>

<script>
import * as api from "@/request/api/apiList/system.js";

// import qs from "qs"
export default {
  data(){
    return{
      slides:[]
    }
  },
  methods: {
    async API_ad() {
      //获取广告数据接口
      //   let result = {
      //       position:1
      //   }
      let params = {
        position: 1
      };
      return await api.ad(params);
    }
  },
  async created() {
    let res = await this.API_ad();
    //console.log(res);
    if(res.data.code === 200){
      this.slides = res.data.data
    }
  }
};
</script>

<style>
</style>